<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>YUI Context Menu Example</title>
    <script type="text/javascript" src="yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="yui/build/container/container_core-min.js"></script>
    <script type="text/javascript" src="yui/build/menu/menu-min.js"></script>
    <link rel="stylesheet" type="text/css" href="yui/build/assets/skins/sam/menu.css">
    <link rel="stylesheet" type="text/css" href="yui/build/reset-fonts-grids/reset-fonts-grids.css">
    <link rel="stylesheet" type="text/css" href="fantasy.css">
  </head>
  <body class="yui-skin-sam">
    <div id="doc" class="yui-t1">
      <div id="hd">
        <h1>DigitalDesigns</h1>
      </div>
      <div id="bd">
        <div class="yui-b">
          <div id="navmenu" class="yuimenu">
            <div class="bd">
              <ul class="first-of-type">
                <li class="yuimenuitem first-of-type"><a class="yuimenuitemlabel" href="aboutme.html">About Me</a></li>
                <li class="yuimenuitem"><a class="yuimenuitemlabel" href="images.html">Images</a>
                  <div id="images" class="yuimenu">
                    <div class="bd">
                      <ul>
                        <li class="yuimenuitem"><a class="yuimenuitemlabel" href="photography.html">Photography</a></li>
                        <li class="yuimenuitem"><a class="yuimenuitemlabel" href="fantasy.html">Fantasy Art</a></li>
                        <li class="yuimenuitem"><a class="yuimenuitemlabel" href="Corporate.html">Corporate Logos</a></li>
                      </ul>
                    </div>
                  </div>
                </li>
                <li class="yuimenuitem"><a class="yuimenuitemlabel" href="blog.html">My Blog</a></li>
                <li class="yuimenuitem"><a class="yuimenuitemlabel" href="contact.html">Contact Me</a></li>
                <li class="yuimenuitem"><a class="yuimenuitemlabel" href="imagelinks.html">Image Resources</a>
                  <div id="links" class="yuimenu">
                    <div class="bd">
                      <ul>
                        <li class="yuimenuitem"><a class="yuimenuitemlabel" href="http://www.flickr.com">Flickr</a></li>
                        <li class="yuimenuitem"><a class="yuimenuitemlabel" href="http://www.b3ta.com">B3ta</a></li>
                        <li class="yuimenuitem"><a class="yuimenuitemlabel" href="http://yotophoto.com">Yoto Photo</a></li>
                      </ul>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </div>
	      <div id="yui-main">
	        <div class="yui-b">
            <p class="content-head">Fantasy Art Images</p>
            <div class="images">
              <img class="thumb" src="images/image1_thumb.jpg" title="Right-click for options (Opera users will need to use the Ctrl key + left-click)" alt="thumb1">
              <img class="thumb" src="images/image2_thumb.jpg" title="Right-click for options (Opera users will need to use the Ctrl key + left-click)" alt="thumb2">
            </div>
          </div>
	      </div>
      </div>
      <div id="ft">
        <p class="ftext">Copyright&copy; Mr Freelance 2008</p>
      </div>
    </div>
    <script type="text/javascript">
      //set up the namespace object for this example
      YAHOO.namespace("yuibook.menu");
      
      //define the initMenu function
      YAHOO.yuibook.menu.initMenu = function() {
        var menu = new YAHOO.widget.Menu("navmenu", { position:"static" });
        menu.render();
      }
      
      //call the initMenu function when the DOM is ready
      YAHOO.util.Event.onDOMReady(YAHOO.yuibook.menu.initMenu);

      //define the addContext function
      YAHOO.yuibook.menu.addContext = function() {
      
        //obtain thumbnails from the page
        var images = YAHOO.util.Dom.getElementsByClassName("thumb");
        
        //use the context constructor to create a context menu
        var context = new YAHOO.widget.ContextMenu("imagecontext", { trigger: images });

        //define the context menuitems
        context.addItem("View full-size");
        context.addItem("Buy this image");
        context.addItem("Image information");
        context.addItem("Rate this image");
        
        //render the context menu (it will remain hidden until the trigger is clicked)
        context.render(document.body);
      }
      
      //call the addContext function when the DOMis ready
      YAHOO.util.Event.onDOMReady(YAHOO.yuibook.menu.addContext);
      
      //define the viewFull function
      YAHOO.yuibook.menu.viewFull = function() {
        alert("You chose the full view option!");
      }
      
      //execute viewFull when the context menu item is clicked
      YAHOO.util.Event.addListener("yui-gen11", "click", YAHOO.yuibook.menu.viewFull);
    </script>
  </body>
</html>



